package com.xbongbong.parent.help;

import com.alibaba.fastjson.JSONArray;
import com.xbongbong.paas.constant.MessageConstant;
import com.xbongbong.paas.constant.TimeConstant;
import com.xbongbong.paas.domain.entity.PaasListGroupEntity;
import com.xbongbong.paas.domain.entity.ext.ConditionsEntityExt;
import com.xbongbong.paas.enums.ConditionEnum;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.FlowStatusEnum;
import com.xbongbong.paas.enums.OtherExpenseSheetTypeEnum;
import com.xbongbong.paas.enums.OtherIncomeSheetTypeEnum;
import com.xbongbong.paas.enums.PaySheetTypeEnum;
import com.xbongbong.paas.enums.PaymentSheetTypeEnum;
import com.xbongbong.paas.pojo.dto.FormDataListDTO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.paas.toolbox.util.DateUtil;
import com.xbongbong.pro.enums.errorcodes.SystemErrorCodeEnum;
import com.xbongbong.saas.constant.BasicConstant;
import com.xbongbong.saas.enums.CustomerStatementStatisticDistributorEnum;
import com.xbongbong.saas.enums.CustomerStatementStatisticEnum;
import com.xbongbong.saas.enums.CustomerStatementStatusEnum;
import com.xbongbong.saas.enums.ListGroupEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.business.AssembleEnum;
import com.xbongbong.saas.enums.business.ClueEnum;
import com.xbongbong.saas.enums.business.ContractEnum;
import com.xbongbong.saas.enums.business.CostAdjustEnum;
import com.xbongbong.saas.enums.business.CustomerManagementEnum;
import com.xbongbong.saas.enums.business.InstockEnum;
import com.xbongbong.saas.enums.business.InventoryEnum;
import com.xbongbong.saas.enums.business.InvoiceEnum;
import com.xbongbong.saas.enums.business.OtherExpenseEnum;
import com.xbongbong.saas.enums.business.OtherIncomeEnum;
import com.xbongbong.saas.enums.business.OutstockEnum;
import com.xbongbong.saas.enums.business.PayPlanEnum;
import com.xbongbong.saas.enums.business.PaySheetEnum;
import com.xbongbong.saas.enums.business.PaymentEnum;
import com.xbongbong.saas.enums.business.PaymentSheetEnum;
import com.xbongbong.saas.enums.business.ProductEnum;
import com.xbongbong.saas.enums.business.ReturnedPurchaseEnum;
import com.xbongbong.saas.enums.business.SalesOpportunityEnum;
import com.xbongbong.saas.enums.business.TransferEnum;
import com.xbongbong.saas.enums.dictionary.PayPlanStatusEnum;
import com.xbongbong.saas.enums.dictionary.PaymentStatusEnum;
import com.xbongbong.saas.model.CommunicatePlanUserModel;
import com.xbongbong.saas.model.TagLinkModel;
import com.xbongbong.sys.domain.entity.UserEntity;
import com.xbongbong.sys.model.UserModel;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/1/23 17:31
 * @since v1.0
 */
@Component
public class ListGroupHelp {

    @Resource
    private UserModel userModel;
    @Resource
    private CommunicatePlanUserModel communicatePlanUserModel;
    @Resource
    private TagLinkModel tagLinkModel;

    /**
     * 负责的
     */
    private static final Integer RESPONSIBLE = 1;
    /**
     * 协同的
     */
    private static final Integer COOPERATE = 0;


    /**
     * 获取默认分组
     *
     * @param formDataListDTO 前端参数
     * @return 默认列表分组
     */
    public PaasListGroupEntity getDefaultGroup(FormDataListDTO formDataListDTO) throws XbbException{
        PaasListGroupEntity paasListGroupEntity = new PaasListGroupEntity();
        Long listGroupId = formDataListDTO.getListGroupId();
        if (Objects.isNull(listGroupId)) {
            throw new XbbException(SystemErrorCodeEnum.API_ERROR_100001, MessageConstant.LIST_GROUP_NOT_EXIST);
        }
        ListGroupEnum listGroupEnum = ListGroupEnum.getBusinessGroup(formDataListDTO.getBusinessType(), listGroupId.intValue());
        if (listGroupEnum == null) {
            throw new XbbException(SystemErrorCodeEnum.API_ERROR_100001, MessageConstant.LIST_GROUP_NOT_EXIST);
        }
        try {
            if (!listGroupEnum.getAlias().equals(ListGroupEnum.UNKONW.getAlias())) {
                Method method = this.getClass().getDeclaredMethod(listGroupEnum.getAlias(), FormDataListDTO.class, PaasListGroupEntity.class);
                method.setAccessible(true);
                method.invoke(this, formDataListDTO, paasListGroupEntity);
            }
        } catch (Exception e) {
           //默认分组没有对应的方法，视为全部分组，无需处理
        }
        return paasListGroupEntity;
    }

    /**
     * 审批中
     * @param formDataListDTO
     * @param paasListGroupEntity
     */
    @SuppressWarnings("unused")
    public void approval(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(FieldTypeEnum.FLOW_STATUS.getAlias());
        conditionsEntityExt.setFieldType(FieldTypeEnum.FLOW_STATUS.getType());
        conditionsEntityExt.setName(FieldTypeEnum.FLOW_STATUS.getDescription());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        conditionsEntityExt.setValue(Arrays.asList(FlowStatusEnum.APPROVAL_PENDING.getType(),FlowStatusEnum.IN_APPROVAL.getType()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }


    /**
     * 今日新增
     * 创建时间在今天内
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    public void addToday(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(FieldTypeEnum.ADDTIME.getAlias());
        conditionsEntityExt.setFieldType(FieldTypeEnum.ADDTIME.getType());
        conditionsEntityExt.setName(FieldTypeEnum.ADDTIME.getDescription());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(DateUtil.getTodayInt());
        valueList.add(DateUtil.getTodayInt() + TimeConstant.SECONDS_PER_DAY);
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本周新增
     * 创建时间在本周内
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    public void addThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(FieldTypeEnum.ADDTIME.getAlias());
        conditionsEntityExt.setFieldType(FieldTypeEnum.ADDTIME.getType());
        conditionsEntityExt.setName(FieldTypeEnum.ADDTIME.getDescription());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(DateUtil.getThisWeekMorning());
        valueList.add(DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK);
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 7天未跟进
     * 跟进时间不为0且小于未来7天后的时间节点
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void weekWithoutFlow(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        String attr = CustomerManagementEnum.LAST_CONNECT_TIME.getAttr();
        String name = CustomerManagementEnum.LAST_CONNECT_TIME.getAttrName();
        if (Objects.equals(formDataListDTO.getBusinessType(), XbbRefTypeEnum.CLUE.getCode())) {
            attr = ClueEnum.LAST_CONNECT_TIME.getAttr();
            name = ClueEnum.LAST_CONNECT_TIME.getAttrName();
        }
        //7天内
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(attr);
        conditionsEntityExt.setFieldType(CustomerManagementEnum.LAST_CONNECT_TIME.getFieldType());
        conditionsEntityExt.setName(name);
        conditionsEntityExt.setSymbol(ConditionEnum.LESSTHAN.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(DateUtil.getTodayInt() - TimeConstant.SECONDS_PER_WEEK));
        conditionsEntityExtList.add(conditionsEntityExt);
        ConditionsEntityExt conditionsEntityExt1 = new ConditionsEntityExt();
        conditionsEntityExt1.setAttr(attr);
        conditionsEntityExt1.setFieldType(CustomerManagementEnum.LAST_CONNECT_TIME.getFieldType());
        conditionsEntityExt1.setName(name);
        conditionsEntityExt1.setSymbol(ConditionEnum.NOEQUAL.getSymbol());
        conditionsEntityExt1.setValue(Collections.singletonList(0));
        conditionsEntityExtList.add(conditionsEntityExt1);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 即将退回公海池
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void goBackSea(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<Long> dataIdList = tagLinkModel.getPublicCustomerIdList(formDataListDTO.getCorpid(), formDataListDTO.getBusinessType());
        if (dataIdList.isEmpty()){
            dataIdList.add(-1L);
        }
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(FieldTypeEnum.DATAID.getAlias(),"",FieldTypeEnum.DATAID.getType(),ConditionEnum.IN.getSymbol(),new ArrayList<>(dataIdList));
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 我负责的
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void responsible(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        String userId = formDataListDTO.getUserId();
        String corpid = formDataListDTO.getCorpid();
        ConditionsEntityExt conditionsEntityExt = teamSearchBase(corpid,userId,formDataListDTO.getBusinessType(),RESPONSIBLE,false);
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 我协同的
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    public void cooperate(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        String userId = formDataListDTO.getUserId();
        String corpid = formDataListDTO.getCorpid();
        ConditionsEntityExt conditionsEntityExt = teamSearchBase(corpid,userId,formDataListDTO.getBusinessType(),COOPERATE,false);
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 下属负责的
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    public void responsibleBySub(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        String userId = formDataListDTO.getUserId();
        String corpid = formDataListDTO.getCorpid();
        ConditionsEntityExt conditionsEntityExt = teamSearchBase(corpid,userId,formDataListDTO.getBusinessType(),RESPONSIBLE,true);
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 下属协同的
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    public void cooperateBySub(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        String userId = formDataListDTO.getUserId();
        String corpid = formDataListDTO.getCorpid();
        ConditionsEntityExt conditionsEntityExt = teamSearchBase(corpid,userId,formDataListDTO.getBusinessType(),COOPERATE,true);
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));

    }

    /**
     * 30天内到期
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void expiresInMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(ContractEnum.DEADLINE.getAttr());
        conditionsEntityExt.setFieldType(ContractEnum.DEADLINE.getFieldType());
        conditionsEntityExt.setName(ContractEnum.DEADLINE.getAttrName());
        conditionsEntityExt.setSymbol(ConditionEnum.RANGE.getSymbol());
        conditionsEntityExt.setValue(Arrays.asList(DateUtil.getTodayInt(),DateUtil.getTodayInt() + TimeConstant.SECONDS_PER_MONTH));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 已过期
     * 预计结束时间小于今天
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void expired(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(SalesOpportunityEnum.ESTIMATE_END_TIME.getAttr());
        conditionsEntityExt.setFieldType(SalesOpportunityEnum.ESTIMATE_END_TIME.getFieldType());
        conditionsEntityExt.setName(SalesOpportunityEnum.ESTIMATE_END_TIME.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.LESSTHAN.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(DateUtil.getTodayInt());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 15天内到期
     * 预计结束时间15天以内
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void expiresInHalfMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(SalesOpportunityEnum.ESTIMATE_END_TIME.getAttr());
        conditionsEntityExt.setFieldType(SalesOpportunityEnum.ESTIMATE_END_TIME.getFieldType());
        conditionsEntityExt.setName(SalesOpportunityEnum.ESTIMATE_END_TIME.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(DateUtil.getTodayInt());
        valueList.add(DateUtil.getTodayInt() + TimeConstant.SECONDS_PER_HALF_MONTH);
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 退货退款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void refund(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(ContractEnum.HAS_RED.getAttr());
        conditionsEntityExt.setFieldType(ContractEnum.HAS_RED.getFieldType());
        conditionsEntityExt.setName(ContractEnum.HAS_RED.getAttrName());
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(1));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 红冲
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void red(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //TODO
    }

    /**
     * 全部未收款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void uncollected(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.UN_RECEIVABLES.getCode());
        valueList.add(PaymentStatusEnum.PARTIAL_RECEIPTS.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 全部逾期未收款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void overdueReceivables(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //未收款
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.UN_RECEIVABLES.getCode());
        valueList.add(PaymentStatusEnum.PARTIAL_RECEIPTS.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));

        //到期
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt();
        conditionsEntityExt2.setAttr(PaymentEnum.ESTIMATE_TIME.getAttr());
        conditionsEntityExt2.setFieldType(PaymentEnum.ESTIMATE_TIME.getFieldType());
        conditionsEntityExt2.setName(PaymentEnum.ESTIMATE_TIME.getAttrName());
        conditionsEntityExt2.setSubAttr("");
        conditionsEntityExt2.setSubAttr("");
        conditionsEntityExt2.setSymbol(ConditionEnum.LESSTHAN.getSymbol());
        List<Object> valueList2 = new ArrayList<>();
        valueList2.add(DateUtil.getTodayInt());
        conditionsEntityExt2.setValue(valueList2);
        conditionsEntityExtList.add(conditionsEntityExt2);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本月到期未收款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void overduePaymentThisMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //未收款
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.UN_RECEIVABLES.getCode());
        valueList.add(PaymentStatusEnum.PARTIAL_RECEIPTS.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));

        //本月
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt();
        conditionsEntityExt2.setAttr(PaymentEnum.ESTIMATE_TIME.getAttr());
        conditionsEntityExt2.setFieldType(PaymentEnum.ESTIMATE_TIME.getFieldType());
        conditionsEntityExt2.setName(PaymentEnum.ESTIMATE_TIME.getAttrName());
        conditionsEntityExt2.setSubAttr("");
        conditionsEntityExt2.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> valueList2 = new ArrayList<>();
        valueList2.add(DateUtil.getFirstDateOfThisMonth());
        valueList2.add(DateUtil.getLastDateOfThisMonth());
        conditionsEntityExt2.setValue(valueList2);
        conditionsEntityExtList.add(conditionsEntityExt2);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本周到期未收款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings({"unused", "Duplicates"})
    private void overduePaymentThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //未收款
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.UN_RECEIVABLES.getCode());
        valueList.add(PaymentStatusEnum.PARTIAL_RECEIPTS.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));

        //本周
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt();
        conditionsEntityExt2.setAttr(PaymentEnum.ESTIMATE_TIME.getAttr());
        conditionsEntityExt2.setFieldType(PaymentEnum.ESTIMATE_TIME.getFieldType());
        conditionsEntityExt2.setName(PaymentEnum.ESTIMATE_TIME.getAttrName());
        conditionsEntityExt2.setSubAttr("");
        conditionsEntityExt2.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> valueList2 = new ArrayList<>();
        valueList2.add(DateUtil.getThisWeekMorning());
        valueList2.add(DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK);
        conditionsEntityExt2.setValue(valueList2);
        conditionsEntityExtList.add(conditionsEntityExt2);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 已收款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void receivable(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.RECEIVABLES.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本周已收款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void receivableThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //已收款
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(PaymentStatusEnum.RECEIVABLES.getCode()));
        conditionsEntityExtList.add(conditionsEntityExt);
        //本周
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt();
        conditionsEntityExt2.setAttr(PaymentEnum.ESTIMATE_TIME.getAttr());
        conditionsEntityExt2.setFieldType(PaymentEnum.ESTIMATE_TIME.getFieldType());
        conditionsEntityExt2.setName(PaymentEnum.ESTIMATE_TIME.getAttrName());
        conditionsEntityExt2.setSubAttr("");
        conditionsEntityExt2.setSubAttr("");
        conditionsEntityExt2.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> valueList2 = new ArrayList<>();
        valueList2.add(DateUtil.getThisWeekMorning());
        valueList2.add(DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK);
        conditionsEntityExt2.setValue(valueList2);
        conditionsEntityExtList.add(conditionsEntityExt2);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 部分已收
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void partiallyAccepted(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.PARTIAL_RECEIPTS.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 红冲退款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void redPayment(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.IS_RED.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.IS_RED.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.IS_RED.getAttrName());
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(1));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 坏账
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void badDebt(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PaymentEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PaymentEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PaymentEnum.STATUS.getAttrName());
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        conditionsEntityExt.setValue(Arrays.asList(PaymentStatusEnum.BAD_DEBT.getCode(), PaymentStatusEnum.PARTIAL_BAD_DEBT.getCode()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));

    }

    /**
     * 全部未付款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void unpaid(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PayPlanEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PayPlanEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PayPlanEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.UN_RECEIVABLES.getCode());
        valueList.add(PaymentStatusEnum.PARTIAL_RECEIPTS.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 全部逾期未付款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void unpaidOverdue(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<Object> valueList = new ArrayList<Object>(){{
            add(PaymentStatusEnum.UN_RECEIVABLES.getCode());
            add(PaymentStatusEnum.PARTIAL_RECEIPTS.getCode());
        }};
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(){{
            setAttr(PayPlanEnum.STATUS.getAttr());
            setFieldType(PayPlanEnum.STATUS.getFieldType());
            setName(PayPlanEnum.STATUS.getAttrName());
            setSubAttr("");
            setSymbol(ConditionEnum.IN.getSymbol());
            setValue(valueList);
        }};
        //逾期
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt(){{
            setAttr(PayPlanEnum.ESTIMATE_TIME.getAttr());
            setFieldType(PayPlanEnum.ESTIMATE_TIME.getFieldType());
            setName(PayPlanEnum.ESTIMATE_TIME.getAttrName());
            setSymbol(ConditionEnum.LESSTHAN.getSymbol());
            setValue(Arrays.asList(DateTimeUtil.getTodayInt()));
        }};

        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<ConditionsEntityExt>(){{
            add(conditionsEntityExt);
            add(conditionsEntityExt2);
        }};
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

        /**
         * 本月到期未付款
         *
         * @param formDataListDTO     前端参数
         * @param paasListGroupEntity 默认分组
         */
    @SuppressWarnings("unused")
    private void paymentDueThisMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //未付款
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PayPlanEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PayPlanEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PayPlanEnum.STATUS.getAttrName());
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        conditionsEntityExt.setValue(Arrays.asList(PaymentStatusEnum.UN_RECEIVABLES.getCode(),PaymentStatusEnum.PARTIAL_RECEIPTS.getCode()));
        conditionsEntityExtList.add(conditionsEntityExt);
        //本月
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt();
        conditionsEntityExt2.setAttr(PayPlanEnum.ESTIMATE_TIME.getAttr());
        conditionsEntityExt2.setFieldType(PayPlanEnum.ESTIMATE_TIME.getFieldType());
        conditionsEntityExt2.setName(PayPlanEnum.ESTIMATE_TIME.getAttrName());
        conditionsEntityExt2.setSymbol(ConditionEnum.RANGE.getSymbol());
        conditionsEntityExt2.setValue(Arrays.asList(DateUtil.getFirstDateOfThisMonth(),DateUtil.getLastDateOfThisMonth()));
        conditionsEntityExtList.add(conditionsEntityExt2);
        //到期
//        ConditionsEntityExt conditionsEntityExt3 = new ConditionsEntityExt();
//        conditionsEntityExt3.setAttr(PayPlanEnum.ESTIMATE_TIME.getAttr());
//        conditionsEntityExt3.setFieldType(PayPlanEnum.ESTIMATE_TIME.getFieldType());
//        conditionsEntityExt3.setName(PayPlanEnum.ESTIMATE_TIME.getAttrName());
//        conditionsEntityExt3.setSymbol(ConditionEnum.LESSTHAN.getSymbol());
//        conditionsEntityExt3.setValue(Collections.singletonList(DateUtil.getTodayInt()));
//        conditionsEntityExtList.add(conditionsEntityExt3);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本周到期未付款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings({"unused", "Duplicates"})
    private void paymentDueThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //未付款
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PayPlanEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PayPlanEnum.STATUS.getFieldType());
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        conditionsEntityExt.setValue(Arrays.asList(PaymentStatusEnum.UN_RECEIVABLES.getCode(),PaymentStatusEnum.PARTIAL_RECEIPTS.getCode()));
        conditionsEntityExtList.add(conditionsEntityExt);
        //本周
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt();
        conditionsEntityExt2.setAttr(PayPlanEnum.ESTIMATE_TIME.getAttr());
        conditionsEntityExt2.setFieldType(PayPlanEnum.ESTIMATE_TIME.getFieldType());
        conditionsEntityExt2.setSymbol(ConditionEnum.RANGE.getSymbol());
        conditionsEntityExt2.setValue(Arrays.asList(DateUtil.getThisWeekMorning(),DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK));
        conditionsEntityExtList.add(conditionsEntityExt2);
        //到期
//        ConditionsEntityExt conditionsEntityExt3 = new ConditionsEntityExt();
//        conditionsEntityExt3.setAttr(PayPlanEnum.ESTIMATE_TIME.getAttr());
//        conditionsEntityExt3.setFieldType(PayPlanEnum.ESTIMATE_TIME.getFieldType());
//        conditionsEntityExt3.setSymbol(ConditionEnum.LESSTHAN.getSymbol());
//        conditionsEntityExt3.setValue(Collections.singletonList(DateUtil.getTodayInt()));
//        conditionsEntityExtList.add(conditionsEntityExt3);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 已付款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void paid(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PayPlanEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PayPlanEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PayPlanEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.RECEIVABLES.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本月已付款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void paidThisMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //已收款
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PayPlanEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PayPlanEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PayPlanEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.RECEIVABLES.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
        //本月
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt();
        conditionsEntityExt2.setAttr(PayPlanEnum.REAL_PAY_TIME.getAttr());
        conditionsEntityExt2.setFieldType(PayPlanEnum.REAL_PAY_TIME.getFieldType());
        conditionsEntityExt2.setName(PayPlanEnum.REAL_PAY_TIME.getAttrName());
        conditionsEntityExt2.setSubAttr("");
        conditionsEntityExt2.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> valueList2 = new ArrayList<>();
        valueList2.add(DateUtil.getFirstDateOfThisMonth());
        valueList2.add(DateUtil.getLastDateOfThisMonth());
        conditionsEntityExt2.setValue(valueList2);
        conditionsEntityExtList.add(conditionsEntityExt2);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本周已付款
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void paidThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        //已收款
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PayPlanEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PayPlanEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PayPlanEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.RECEIVABLES.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
        //本周
        ConditionsEntityExt conditionsEntityExt2 = new ConditionsEntityExt();
        conditionsEntityExt2.setAttr(PayPlanEnum.REAL_PAY_TIME.getAttr());
        conditionsEntityExt2.setFieldType(PayPlanEnum.REAL_PAY_TIME.getFieldType());
        conditionsEntityExt2.setName(PayPlanEnum.REAL_PAY_TIME.getAttrName());
        conditionsEntityExt2.setSubAttr("");
        conditionsEntityExt2.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> valueList2 = new ArrayList<>();
        valueList2.add(DateUtil.getThisWeekMorning());
        valueList2.add(DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK);
        conditionsEntityExt2.setValue(valueList2);
        conditionsEntityExtList.add(conditionsEntityExt2);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 部分已付
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void partiallyPaid(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PayPlanEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PayPlanEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PayPlanEnum.STATUS.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        List<Object> valueList = new ArrayList<>();
        valueList.add(PaymentStatusEnum.PARTIAL_RECEIPTS.getCode());
        conditionsEntityExt.setValue(valueList);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 坏账
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void payBadDebt(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(PayPlanEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(PayPlanEnum.STATUS.getFieldType());
        conditionsEntityExt.setName(PayPlanEnum.STATUS.getAttrName());
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        conditionsEntityExt.setValue(Arrays.asList(PayPlanStatusEnum.BAD_DEBT.getCode(), PayPlanStatusEnum.PARTIAL_BAD_DEBT.getCode()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 上架
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void online(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(ProductEnum.ONLINE.getAttr());
        conditionsEntityExt.setFieldType(ProductEnum.ONLINE.getFieldType());
        conditionsEntityExt.setName(ProductEnum.ONLINE.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(1));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 下架
     *
     * @param formDataListDTO     前端参数
     * @param paasListGroupEntity 默认分组
     */
    @SuppressWarnings("unused")
    private void downline(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(ProductEnum.ONLINE.getAttr());
        conditionsEntityExt.setFieldType(ProductEnum.ONLINE.getFieldType());
        conditionsEntityExt.setName(ProductEnum.ONLINE.getAttrName());
        conditionsEntityExt.setSubAttr("");
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(0));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    private void create(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(FieldTypeEnum.CREATORID.getAlias());
        conditionsEntityExt.setFieldType(FieldTypeEnum.CREATORID.getType());
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(formDataListDTO.getUserId()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    private void createBySub(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        UserEntity userEntity = userModel.getByKey(formDataListDTO.getUserId(),formDataListDTO.getCorpid());
        Integer dataPermission = userModel.getDataPermission(userEntity);
        List<String> userIdList = userModel.getSubIdListByDataPermission(dataPermission, formDataListDTO.getUserId(), formDataListDTO.getCorpid(), BasicConstant.ZERO, true);
        if (userIdList.isEmpty()){
            userIdList.add("-1");
        }
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(FieldTypeEnum.CREATORID.getAlias());
        conditionsEntityExt.setFieldType(FieldTypeEnum.CREATORID.getType());
        conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
        conditionsEntityExt.setValue(new ArrayList<>(userIdList));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 对账单待确认
     * @param formDataListDTO
     * @param paasListGroupEntity
     */
    private void unconfirmedStatement(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(CustomerStatementStatisticDistributorEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(CustomerStatementStatisticDistributorEnum.STATUS.getFieldType());
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(CustomerStatementStatusEnum.UNCONFIRMED.getCode()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 待处理
     * @param formDataListDTO
     * @param paasListGroupEntity
     */
    private void pendingStatement(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(CustomerStatementStatisticDistributorEnum.STATUS.getAttr());
        conditionsEntityExt.setFieldType(CustomerStatementStatisticDistributorEnum.STATUS.getFieldType());
        conditionsEntityExt.setSymbol(ConditionEnum.EQUAL.getSymbol());
        conditionsEntityExt.setValue(Collections.singletonList(CustomerStatementStatusEnum.PENDING.getCode()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本月生成
     * @param formDataListDTO
     * @param paasListGroupEntity
     */
    private void monthStatement(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        conditionsEntityExt.setAttr(CustomerStatementStatisticEnum.CREATE_DATE.getAttr());
        conditionsEntityExt.setFieldType(CustomerStatementStatisticEnum.CREATE_DATE.getFieldType());
        conditionsEntityExt.setSymbol(ConditionEnum.RANGE.getSymbol());
        List<Object> dateRange = new ArrayList<>();
        dateRange.add(DateTimeUtil.getFirstDateOfThisMonth());
        dateRange.add(DateTimeUtil.getLastDateOfThisMonth());
        conditionsEntityExt.setValue(dateRange);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }
    /**
     * 本周回款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 11:30
     * @since v1.0
     */
    private void paymentSheetThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaymentSheetEnum paymentTime = PaymentSheetEnum.PAYMENT_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(paymentTime.getAttr(), "", paymentTime.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getThisWeekMorning(), DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本月回款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 13:54
     * @since v1.0
     */
    private void paymentSheetThisMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaymentSheetEnum paymentTime = PaymentSheetEnum.PAYMENT_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(paymentTime.getAttr(), "", paymentTime.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getFirstDateOfThisMonth(), DateUtil.getLastDateOfThisMonth()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 上月回款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 13:57
     * @since v1.0
     */
    private void paymentSheetLastMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaymentSheetEnum paymentTime = PaymentSheetEnum.PAYMENT_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(paymentTime.getAttr(), "", paymentTime.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateTimeUtil.getFirstDateOfLastMonth(), DateTimeUtil.getFirstDateOfThisMonth()-1));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 红冲回款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 14:58
     * @since v1.0
     */
    private void paymentSheetRed(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaymentSheetEnum paymentSheetType = PaymentSheetEnum.PAYMENT_SHEET_TYPE;
        List<Object> value = Arrays.asList(PaymentSheetTypeEnum.RED_WRITE_OFF.getCode(), PaymentSheetTypeEnum.RED_WRITE_OFF_PREPAYMENT.getCode(), PaymentSheetTypeEnum.RED_WRITE_OFF_BALANCE.getCode(), PaymentSheetTypeEnum.RED_PREPAYMENT.getCode());
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(paymentSheetType.getAttr(), "", paymentSheetType.getFieldType(), ConditionEnum.IN.getSymbol(),
                value);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 坏账回款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 15:01
     * @since v1.0
     */
    private void paymentSheetBad(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaymentSheetEnum paymentSheetType = PaymentSheetEnum.PAYMENT_SHEET_TYPE;
        List<Object> value = Collections.singletonList(PaymentSheetTypeEnum.BAD_PAYMENT.getCode());
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(paymentSheetType.getAttr(), "", paymentSheetType.getFieldType(), ConditionEnum.EQUAL.getSymbol(),
                value);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本周付款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 11:30
     * @since v1.0
     */
    private void paySheetThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaySheetEnum payTime = PaySheetEnum.REAL_PAY_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(payTime.getAttr(), "", payTime.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getThisWeekMorning(), DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本月付款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 13:54
     * @since v1.0
     */
    private void paySheetThisMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaySheetEnum payTime = PaySheetEnum.REAL_PAY_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(payTime.getAttr(), "", payTime.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getFirstDateOfThisMonth(), DateUtil.getLastDateOfThisMonth()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 上月付款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 13:57
     * @since v1.0
     */
    private void paySheetLastMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaySheetEnum payTime = PaySheetEnum.REAL_PAY_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(payTime.getAttr(), "", payTime.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getFirstDateOfLastMonth(), DateUtil.getFirstDateOfThisMonth()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 红冲付款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 14:58
     * @since v1.0
     */
    private void paySheetRed(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaySheetEnum paySheetType = PaySheetEnum.PAY_SHEET_TYPE;
        List<Object> value = Arrays.asList(PaySheetTypeEnum.RED_WRITE_OFF_PAY.getCode(), PaySheetTypeEnum.RED_WRITE_OFF_PREPAY.getCode(), PaySheetTypeEnum.RED_PREPAY.getCode());
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(paySheetType.getAttr(), "", paySheetType.getFieldType(), ConditionEnum.IN.getSymbol(),
                value);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 坏账付款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author 徐俊杰
     * @date 2019/11/19 15:01
     * @since v1.0
     */
    private void paySheetBad(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        PaySheetEnum paySheetType = PaySheetEnum.PAY_SHEET_TYPE;
        List<Object> value = Collections.singletonList(PaySheetTypeEnum.BAD_PAY.getCode());
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(paySheetType.getAttr(), "", paySheetType.getFieldType(), ConditionEnum.EQUAL.getSymbol(),
                value);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本周收入
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author zcp
     * @since v1.0
     */
    private void otherIncomeThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        OtherIncomeEnum timeEnum = OtherIncomeEnum.INCOME_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(timeEnum.getAttr(), "", timeEnum.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getThisWeekMorning(), DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本月收入
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author zcp
     * @since v1.0
     */
    private void otherIncomeThisMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        OtherIncomeEnum timeEnum = OtherIncomeEnum.INCOME_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(timeEnum.getAttr(), "", timeEnum.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getFirstDateOfThisMonth(), DateUtil.getLastDateOfThisMonth()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 上月收入
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author zcp
     * @since v1.0
     */
    private void otherIncomeLastMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        OtherIncomeEnum timeEnum = OtherIncomeEnum.INCOME_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(timeEnum.getAttr(), "", timeEnum.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getFirstDateOfLastMonth(), DateUtil.getFirstDateOfThisMonth()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }
    /**
     * 其他收入单 - 红冲已收款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author zcp
     * @since v1.0
     */
    private void otherIncomeRed(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        OtherIncomeEnum sheetType = OtherIncomeEnum.SHEET_TYPE_OTHER;
        List<Object> value = Arrays.asList(OtherIncomeSheetTypeEnum.RED_OTHER_INCOME.getCode());
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(sheetType.getAttr(), "", sheetType.getFieldType(), ConditionEnum.IN.getSymbol(), value);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本周支出
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author zcp
     * @since v1.0
     */
    private void otherExpenseThisWeek(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        OtherExpenseEnum timeEnum = OtherExpenseEnum.EXPENSE_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(timeEnum.getAttr(), "", timeEnum.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getThisWeekMorning(), DateUtil.getThisWeekMorning() + TimeConstant.SECONDS_PER_WEEK));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 本月支出
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author zcp
     * @since v1.0
     */
    private void otherExpenseThisMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        OtherExpenseEnum timeEnum = OtherExpenseEnum.EXPENSE_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(timeEnum.getAttr(), "", timeEnum.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getFirstDateOfThisMonth(), DateUtil.getLastDateOfThisMonth()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

    /**
     * 上月支出
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author zcp
     * @since v1.0
     */
    private void otherExpenseLastMonth(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        OtherExpenseEnum timeEnum = OtherExpenseEnum.EXPENSE_TIME;
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(timeEnum.getAttr(), "", timeEnum.getFieldType(), ConditionEnum.RANGE.getSymbol(),
                Arrays.asList(DateUtil.getFirstDateOfLastMonth(), DateUtil.getFirstDateOfThisMonth()));
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }
    /**
     * 其他支出单 - 红冲已付款
     *
     * @param formDataListDTO 前端参数
     * @param paasListGroupEntity 默认分组
     * @author zcp
     * @since v1.0
     */
    private void otherExpenseRed(FormDataListDTO formDataListDTO, PaasListGroupEntity paasListGroupEntity) {
        List<ConditionsEntityExt> conditionsEntityExtList = new ArrayList<>();
        OtherExpenseEnum sheetType = OtherExpenseEnum.SHEET_TYPE_OTHER;
        List<Object> value = Arrays.asList(OtherExpenseSheetTypeEnum.RED_OTHER_EXPENSE.getCode());
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt(sheetType.getAttr(), "", sheetType.getFieldType(), ConditionEnum.IN.getSymbol(), value);
        conditionsEntityExtList.add(conditionsEntityExt);
        paasListGroupEntity.setJsonData(JSONArray.toJSONString(conditionsEntityExtList));
    }

        /********************************************辅助方法 ******************************************************************/
    /**
     * @param corpid
     * @param userId
     * @param businessType
     * @param isMain
     * @param isSub
    */
    public ConditionsEntityExt teamSearchBase(String corpid, String userId,Integer businessType, Integer isMain, boolean isSub){
        ConditionsEntityExt conditionsEntityExt = new ConditionsEntityExt();
        List<Long> dataIdList;
        XbbRefTypeEnum xbbRefTypeEnum = XbbRefTypeEnum.getByCode(businessType);
        List<String> userIdList = new ArrayList<>();
        if (isSub){
            UserEntity userEntity = userModel.getByKey(userId,corpid);
            Integer dataPermission = userModel.getDataPermission(userEntity);
            userIdList = userModel.getSubIdListByDataPermission(dataPermission, userId, corpid, BasicConstant.ZERO, true);
            if (userIdList.isEmpty()){
                userIdList.add("-1");
            }
        }else {
            userIdList.add(userId);
        }
        FieldTypeEnum fieldTypeEnum;
        if (Objects.equals(isMain,1)){
            fieldTypeEnum = FieldTypeEnum.OWNERID;
        }else {
            fieldTypeEnum = FieldTypeEnum.COUSERID;
        }

        switch (xbbRefTypeEnum){
            case CUSTOMER_MANAGEMENT:
            case CONTACT:
            case CONTRACT:
            case SALES_OPPORTUNITY:
            case REFUND:
            case PAYMENT:
            case PAY_PLAN:
            case SUPPLIER:
            case SUPPLIER_CONTACT:
            case PURCHASE:
            case BOM_BILL:
            case PRODUCTION_ORDER:
            case QUOTATION:
            case CLUE:
            case MARKET_ACTIVITY:
            case ORDER:
            case RETURN:
                conditionsEntityExt.setAttr(fieldTypeEnum.getAlias());
                conditionsEntityExt.setFieldType(fieldTypeEnum.getType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case CUSTOMER_COMMUNICATE:
            case SUPPLIER_COMMUNICATE:
                conditionsEntityExt.setAttr(FieldTypeEnum.CREATORID.getAlias());
                conditionsEntityExt.setFieldType(FieldTypeEnum.CREATORID.getType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case RETURNED_PURCHASE:
                //TODO 退货负责人
                conditionsEntityExt.setAttr(ReturnedPurchaseEnum.MANAGER_ID.getAttr());
                conditionsEntityExt.setFieldType(ReturnedPurchaseEnum.MANAGER_ID.getFieldType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case INVOICE:
                //TODO 申请人
                conditionsEntityExt.setAttr(InvoiceEnum.APPLY_USER.getAttr());
                conditionsEntityExt.setFieldType(InvoiceEnum.APPLY_USER.getFieldType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case ASSEMBLE:
                //TODO 负责人
                conditionsEntityExt.setAttr(AssembleEnum.MANAGER_ID.getAttr());
                conditionsEntityExt.setFieldType(AssembleEnum.MANAGER_ID.getFieldType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case INSTOCK:
            case PURCHASE_INSTOCK:
            case REFUND_INSTOCK:
            case OTHER_INSTOCK:
            case PRODUCTION_INSTOCK:
            case RETURNED_MATERIEL_INSTOCK:
                conditionsEntityExt.setAttr(InstockEnum.MANAGER_ID.getAttr());
                conditionsEntityExt.setFieldType(InstockEnum.MANAGER_ID.getFieldType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case OUTSTOCK:
            case CONTRACT_OUTSTOCK:
            case RETURNED_PURCHASE_OUTSTOCK:
            case OTHER_OUTSTOCK:
            case PRODUCTION_MATERIEL_OUTSTOCK:
            case WORK_ORDER_OUTSTOCK:
                conditionsEntityExt.setAttr(OutstockEnum.MANAGER_ID.getAttr());
                conditionsEntityExt.setFieldType(OutstockEnum.MANAGER_ID.getFieldType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case TRANSFER:
                conditionsEntityExt.setAttr(TransferEnum.MANAGER_NAME.getAttr());
                conditionsEntityExt.setFieldType(TransferEnum.MANAGER_NAME.getFieldType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case INVENTORY:
                conditionsEntityExt.setAttr(InventoryEnum.MANAGER_ID.getAttr());
                conditionsEntityExt.setFieldType(InventoryEnum.MANAGER_ID.getFieldType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
            case COMMUNICATE_PLAN:
                dataIdList = communicatePlanUserModel.getDataIdList(corpid,userIdList);
                if (dataIdList.isEmpty()){
                    dataIdList.add(-1L);
                }
                conditionsEntityExt.setAttr(FieldTypeEnum.DATAID.getAlias());
                conditionsEntityExt.setFieldType(FieldTypeEnum.DATAID.getType());
                conditionsEntityExt.setName(FieldTypeEnum.DATAID.getDescription());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(dataIdList));
                break;
            case COST_ADJUST:
                conditionsEntityExt.setAttr(CostAdjustEnum.OWNER_ID.getAttr());
                conditionsEntityExt.setFieldType(CostAdjustEnum.OWNER_ID.getFieldType());
                conditionsEntityExt.setSymbol(ConditionEnum.IN.getSymbol());
                conditionsEntityExt.setValue(new ArrayList<>(userIdList));
                break;
        }
        return conditionsEntityExt;
    }
}
